package hot100;

public class Lc283 {
    public void moveZeroes(int[] nums) {
        int left = 0;
        int right = 0;
        while (right < nums.length) {
            while (nums[left] != 0) {
                left++;
                if (left >= nums.length) {
                    return;
                }
            }
            right = left;
            while (nums[right] == 0) {
                right++;
                if (right >= nums.length) {
                    return;
                }
            }

            int temp = nums[left];
            nums[left] = nums[right];
            nums[right] = temp;
        }
    }

    public static void main(String[] args) {
        Lc283 lc283 = new Lc283();
        lc283.moveZeroes(new int[]{0, 1, 0, 3, 12});
    }
}
